@extends('admin.formLayout')
@section('title','网站设置')
@section('barName','网站设置')
@section('content')
    <form method="post" class="layui-form" action="{{route('admin.setting-store')}}">
        {{csrf_field()}}

    <div class="layui-tab">
    <ul class="layui-tab-title">
        @php
            $i = 1;
        @endphp
        @foreach($items as $k=>$v)
            <li class="{{$i++==1?'layui-this' : ''}}">{{$k}}</li>
        @endforeach
    </ul>

    <div class="layui-tab-content">

        @php
            $i = 1;
        @endphp
        @foreach($items as $k=>$v)
            <div class="layui-tab-item {{$i++==1?'layui-show' : ''}}">
                @foreach($v as $kk=>$vv)
                    <div class="layui-form-item">
                        <label class="layui-form-label">{{$vv['desc']}}</label>
                        <div class="layui-input-block">
                    @if($vv['type'] == 'text')

                                <input value="{{$vv['value']}}" name="filed{{$i}}_{{$vv['name']}}" class="layui-input" lay-verify="required"/>

                    @elseif($vv['type'] == 'image')
                        @include('admin.form.image',['name'=>'filed'.$i.'_'.$vv['name'],'value'=>$vv['value']])
                    @elseif($vv['type'] ==  'radio')

                        @foreach(json_decode($vv['options'],true) as $k1=>$v1)
                                    <input value="{{$k1}}" @if($k1==$vv['value']) checked @endif name="filed{{$i}}_{{$vv['name']}}" class="layui-input" lay-verify="required" type="radio" title="{{$v1}}"/>

                        @endforeach

                    @endif
                            <input type="hidden" name="filed{{$i}}[group]" value="{{$vv['group']}}"/>
                            </div>
                        @if($vv['helper'])
                            <div class="layui-input-block">
                                <p>{{$vv['helper']}}</p>
                            </div>
                        @endif
                        </div>
                @endforeach
            </div>
        @endforeach

    </div>

</div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="form">立即提交</button>
            </div>
        </div>
    </form>

<script>
    layui.use('element', function() {
        var $ = layui.jquery
            , element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

    })
</script>
@endsection